package com.godme.idea;

public class Circle {



    public boolean isCircle(Node node){
        Node slowPoint = node;
        Node fastPoint = node;

       do{
           slowPoint = slowPoint.next;
           fastPoint = fastPoint.next;
           if(fastPoint == null){
               return false;
           }
           fastPoint = fastPoint.next;
           if(fastPoint == slowPoint){
               return true;
           }
       }while (slowPoint != null && fastPoint != null);

        return true;
    }

    public static class Node{
        Node next;
    }
}
